<template>
  <div id="home">
    <search style="float: left; margin-left: 22%"/>
    <div class="btns">
      <!-- <router-link to='/release' tag="el-button" class="el-button--primary is-plain" @click="releaseClick">发布商品</router-link> -->
      <!-- <router-link to="/seek" tag="el-button" class="el-button--primary is-plain">求购商品</router-link> -->
      <el-button type="primary" plain @click="releaseClick">发布商品</el-button>
      <el-button type="primary" plain @click="seekClick">求购商品</el-button>
    </div>
    <banner style="clear: both"/>
    <navigation/>
    <serve/>
    <after-sale/>
    <foot/>
  </div>
</template>

<script>
  import search from '@/components/home/search/search'
  import banner from '@/components/home/banner/banner'
  import navigation from '@/components/home/navigation/navigation'
  import serve from '@/components/home/serve/serve'
  import afterSale from '@/components/home/afterSale/afterSale'
  import foot from '@/components/home/foot/foot'

export default {
  name: 'home',
  components: {
    banner,
    serve,
    foot,
    afterSale,
    search,
    // backtop,
    navigation
  },
  methods: {
    releaseClick() {
      if(this.$store.state.isLogin) {
        this.$router.push('/release')
      } else {
         this.$message({
          message: '您还未登录，请先登录！！',
          type: 'warning'
        })
        this.$router.push('/login')
      }
    },
    seekClick() {
      if(this.$store.state.isLogin) {
        this.$router.push('/seek')
      } else {
         this.$message({
          message: '您还未登录，请先登录！！',
          type: 'warning'
        })
        this.$router.push('/login')
      }
    }
  }
}
</script>

<style scoped>
  #home .btns {
    float: left;
    margin-top: 35px;
    margin-left: -80px;
  }
</style>